package com.accountsmanager.service;

import java.util.Date;

import com.accountsmanager.dao.LoginDao;
import com.accountsmanager.dto.DataDictionary;
import com.accountsmanager.dto.NoteBaseInfo;
import com.accountsmanager.dto.UserInfo;

public class LoginService {
	
	private LoginDao loginDao;
	
	public void login(){
		loginDao.userLogin("test");
	}
	
	public void addUser(String userCount,String userPsw,String userName){
		UserInfo u = new UserInfo();
		u.setUserCount(userCount);
		u.setUserPsw(userPsw);
		u.setUserName(userName);
		loginDao.addUser(u);
	}
	
	public void addNoteBaseInfo(String noteName,String noteType,String userName){
		NoteBaseInfo note = new NoteBaseInfo();
		note.setNoteName(noteName);
		note.setNoteType(noteType);
		note.setCreateUser(userName);
		Date date = new Date();
		note.setCreateTime(date);
		loginDao.addNoteBaseInfo(note);
	}

	public void addDataDictionary(String dictType,String dictTypeName,String dictCode,String dictCodeName){
		DataDictionary dd = new DataDictionary();
		dd.setDictType(dictType);
		dd.setDictTypeName(dictTypeName);
		dd.setDictCode(dictCode);
		dd.setDictCodeName(dictCodeName);
		loginDao.addDataDictionary(dd);
	}
	
	public void getUser(){
		UserInfo user = loginDao.getUserInfo(0);
		user.getUserCount();
	}
	
	public LoginDao getLoginDao() {
		return loginDao;
	}

	public void setLoginDao(LoginDao loginDao) {
		this.loginDao = loginDao;
	}
}
